<!--回弹业务数据字典---试验检测依据管理---查看-->
<template>
  <div class="department">
    <!-- 右侧 -->
    <div class="department_right">
      <!-- 机构名称 -->
      <div class="department_right_name">
        <div>样品种类信息</div>
      </div>
      <!-- 顶部导航栏 -->
      <div class="mechanism_nav">
        <!-- 左侧 -->
        <div class="mechanism_nav_left"></div>
        <!-- 顶部按钮 -->
        <div class="print">
          <div class="printTable">
            <el-button
              type="primary"
              icon="el-icon-refresh"
              size="small"
              @click="yj_editForm()"
            ></el-button>
          </div>
        </div>
      </div>

      <!-- 表格 -->
      <div class="text_table">
        <!-- :rowKey="rowKey" -->
        <tableData
          :config="table_config"
          :height="navigatepageNums > 1 ? 'calc(100% - 50px)' : '100%'"
          :dataList="tableData"
          :loading="listLoading"
          @selection-change="selectionChange"
          @sort-change="sortChange"
          @click-change="rowChange"
          @openDialog="openDialog"
        />
      </div>
    </div>
  </div>
</template>

<script>
import { getCheckSpecsItemsList } from "@/api/request.js";
import TableData from "@/components/public/el-table";

export default {
  inject: ["reload"],
  name: "Home",
  data() {
    return {
      name: "sample",
      dialogHeight: "",
      listLoading: false,
      dialogFormVisible: false,
      tableData: [], //表格数据列表
      navigatepageNums:null,
      // 拌和站列表配置项
      table_config: {
        imgKeyWord: "url",
        fileKeyWord: "url",
        fileName: "fFileName",

        dialogHeight: "",
        thead: [
          {
            label: "标准代号",
            prop: "fItemno",
            minWidth: "150px",
            routerPath: "xxx",
            align: "left",
          },
          {
            label: "样品名称",
            prop: "fItemname",
            minWidth: "100px",
            routerPath: "xxx",
            align: "left",
          },
          {
            label: "备注",
            prop: "fNote",
            minWidth: "150px",
            routerPath: "xxx",
            align: "left",
          },
        ],
        isCheckBox: false,
        isIndex: true,
        isOperation: true,
      },
    };
  },
  mounted() {
    this.yj_editForm();
  },
  components: {
    TableData,
  },
  methods: {
    // 获取列表数据
    yj_editForm() {
      this.listLoading = true;
      getCheckSpecsItemsList({})
        .then((res) => {
          if (res.errcode == 0) {
            var that = this;
            that.listLoading = false;
            that.tableData = res.data.checkSpecsItemsList;
            that.navigatepageNums=that.tableData.length;
          } else {
            this.$message.error("列表获取", res.msg);
            this.listLoading = false;
          }
        })
        .catch(() => {
          console.log("列表获取");
          this.listLoading = false;
        });
    },
    // 点击当前行变色
    rowChange(val) {
      this.currentRow = val;
    },

    // 多选方法
    selectionChange() {},
    // 排序方法
    sortChange() {},
    // 点击设备编码
    openDialog(row) {
      return row;
      // this.fId = row.F_Id;
      // this.editText(this.fId);
    },
  },
};
</script>

<style scoped>
.printTables {
  background: #fff;
  display: flex;
  justify-content: end;
  padding: 5px;
  margin-top: 10px;
}

.dialogBody {
  padding: 3px 20px;
  height: 80%;
  overflow-y: auto;
}
</style>